import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:industry_net/base/common/util.dart';
import 'package:industry_net/base/component/component.dart';
import 'package:industry_net/base/component/list/table_view.dart';
import 'widgets/comment_bar/comment_bar.dart';
import 'widgets/header.dart';

import 'index.dart';

class NewsDetailPage extends GetView<NewsDetailController> {
  const NewsDetailPage({Key? key}) : super(key: key);

  // 内容页
  Widget _buildView() {
    return TableView(
        header: NewsDetailHeader(),
        separatorIndent: gap12,
        data: controller.state.data ?? []);
  }

  @override
  Widget build(BuildContext context) {
    controller.state.context = context;
    return GetBuilder<NewsDetailController>(
      builder: (_) {
        return Scaffold(
          appBar: detailAppBar(context, title: '资讯详情', actions: [
            InkWell(
              onTap: controller.actionShare,
              child: Container(
                padding: EdgeInsets.symmetric(horizontal: gap12),
                child: const Icon(
                  Icons.more_horiz_outlined,
                  color: ColorsUtil.subTitle,
                ),
              ),
            )
          ]),
          backgroundColor: Colors.white,
          body: Padding(
            padding: EdgeInsets.only(bottom: SizeFit.safeBottom + 50.r),
            child: _buildView(),
          ),
          floatingActionButtonLocation:
              FloatingActionButtonLocation.centerFloat,
          floatingActionButton: NewsCommentBar(
            controller: controller.controller,
          ),
        );
      },
    );
  }
}

// class AnimationWidget extends StatefulWidget {
//   AnimationWidget({Key? key}) : super(key: key);

//   @override
//   _AnimationWidgetState createState() => _AnimationWidgetState();
// }

// class _AnimationWidgetState extends State<AnimationWidget> {
//   @override
//   Widget build(BuildContext context) {
//     return Container();
//   }
// }
